package app.controller.city;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import app.entity.UserSession;
import app.service.UserManageService;
import app.utils.Common;
import app.utils.DataResponse;
@Controller
public class UserController {
	
	@Autowired
	@Qualifier("UserManageService")
	private UserManageService userService;
	
	@RequestMapping(value="/users/region" ,method=RequestMethod.GET)
	public void users(HttpServletResponse response,HttpSession session){
		UserSession user = (UserSession) session.getAttribute(Common.sessionUser);
		List<Map<String,Object>> allWorkerThisRegion = userService.getAllWorkerThisRegion((user==null)?1:user.getRegionId());
		DataResponse.jsonResponse(response, allWorkerThisRegion);
	}
}
